// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//


#include <pollux/expression/register_special_form.h>

#include <pollux/expression/cast_expr.h>
#include <pollux/expression/coalesce_expr.h>
#include <pollux/expression/conjunct_expr.h>
#include <pollux/expression/function_call_to_special_form.h>
#include <pollux/expression/row_constructor.h>
#include <pollux/expression/special_form_registry.h>
#include <pollux/expression/switch_expr.h>
#include <pollux/expression/try_expr.h>

namespace kumo::pollux::exec {
    void registerFunctionCallToSpecialForms() {
        registerFunctionCallToSpecialForm(
            kAnd, std::make_unique<ConjunctCallToSpecialForm>(true /* isAnd */));
        registerFunctionCallToSpecialForm(
            kCast.str(), std::make_unique<CastCallToSpecialForm>());
        registerFunctionCallToSpecialForm(
            kTryCast.str(), std::make_unique<TryCastCallToSpecialForm>());
        registerFunctionCallToSpecialForm(
            kCoalesce, std::make_unique<CoalesceCallToSpecialForm>());
        registerFunctionCallToSpecialForm(
            kIf, std::make_unique<IfCallToSpecialForm>());
        registerFunctionCallToSpecialForm(
            kOr, std::make_unique<ConjunctCallToSpecialForm>(false /* isAnd */));
        registerFunctionCallToSpecialForm(
            kSwitch, std::make_unique<SwitchCallToSpecialForm>());
        registerFunctionCallToSpecialForm(
            kTry, std::make_unique<TryCallToSpecialForm>());
        registerFunctionCallToSpecialForm(
            RowConstructorCallToSpecialForm::kRowConstructor,
            std::make_unique<RowConstructorCallToSpecialForm>());
    }
} // namespace kumo::pollux::exec
